package org.zzz.service.impl;

import org.apache.ibatis.session.SqlSession;
import org.zzz.entity.Class;
import org.zzz.mapper.ClassMapper;
import org.zzz.service.ClassService;
import org.zzz.utils.MybatisUtil;

import java.util.List;

/**
 * @Author ZZF
 * @Time 2021/04/20 22:45
 */
public class ClassServiceImpl implements ClassService {
    private ClassMapper classMapper;

    {
//        SqlSession sqlSession = MybatisUtil.getSqlSession();
        classMapper = MybatisUtil.getMapper(ClassMapper.class);
    }

    @Override
    public List<Class> listClass() {
        return classMapper.listClass();
    }

    @Override
    public Class getClassById(String id) {
        return classMapper.getClassById(id);
    }

    @Override
    public boolean insertClass(Class classObject) {
        return classMapper.insertClass(classObject) > 0;
    }

    @Override
    public boolean updateClass(Class classObject) {
        return classMapper.updateClass(classObject) > 0;
    }

    @Override
    public boolean deleteClassById(String id) {
        return classMapper.deleteClassById(id) > 0;
    }
}
